#!/usr/bin/python

import wx,sys

class MainPanel(wx.Panel):

	def __init__(me,parent):
		wx.Panel.__init__(me,parent)		
		me.button = wx.Button(me,wx.ID_ANY,"Button", (200,200))
		me.Bind(wx.EVT_BUTTON, me.OnClick, me.button)
		
	def OnClick(me,e):
		print 'out> Clicked!'
		sys.stderr.write('err> Clicked!\n')
		pass

		
class MainFrame(wx.Frame):

	def __init__(me):
			
		wx.Frame.__init__(me,parent=None)
		p=MainPanel(parent=me)
		
		if 1:
			me.output_window = wx.TextCtrl(p, -1, "", wx.DefaultPosition, 
						wx.DefaultSize, wx.TE_MULTILINE|wx.SUNKEN_BORDER)
			me.output_window.SetValue("Output Window\n")
			#redirecting output
			sys.stdout = me.output_window
			sys.stderr = me.output_window 

app = wx.PySimpleApp()
frame = MainFrame()
frame.Show()
frame.Centre()
app.MainLoop()